//
//  MomentumViewController.m
//  LottieAnimationTest
//
//  Created by Felix Yin on 2019/7/16.
//  Copyright © 2019 Felix Yin. All rights reserved.
//

#import "MomentumViewController.h"
#import "MomentumVIew/MomentumView.h"
#import "Comment.h"

@interface MomentumViewController ()

@property(nonatomic,strong) MomentumView *momentumView;

@end

@implementation MomentumViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.momentumView];
}

- (void) viewDidLayoutSubviews{
    [super viewDidLayoutSubviews];
    CGFloat maxTopOffset = CGRectGetHeight(self.view.frame) * 0.75;
    CGFloat minTopOffSet = CGRectGetHeight(self.view.frame) * 0.25;
    CGFloat y = maxTopOffset;
    CGFloat x = 0;
    CGFloat width = CGRectGetWidth(self.view.frame);
    CGFloat height = CGRectGetHeight(self.view.frame);
    self.momentumView.maxTopOffset = maxTopOffset;
    self.momentumView.minTopOffset = minTopOffSet;
    self.momentumView.frame = CGRectMake(x, y, width, height);
    [self.view addSubview:self.momentumView];
}


//    MARK: Lazy Loading

- (MomentumView *)momentumView{
    if (!_momentumView) {
        _momentumView = [[MomentumView alloc] initWithFrame:CGRectZero];
        _momentumView.backgroundColor = [UIColor redColor];
        _momentumView.layer.cornerRadius = 6;
        _momentumView.layer.masksToBounds = YES;
    }
    return _momentumView;
}

@end
